<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
<!-- Loading Bootstrap -->
<link href="http://127.0.0.1/cms_edu/Static/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
<!-- Loading Flat UI -->
<link href="http://127.0.0.1/cms_edu/Static/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
<link href="http://127.0.0.1/cms_edu/Static/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
<link rel="shortcut icon" href="http://127.0.0.1/cms_edu/Static/Admin/Flat/img/favicon.ico">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="dist/js/vendor/html5shiv.js"></script>
  <script src="dist/js/vendor/respond.min.js"></script>
<![endif]-->
		 <script type="text/javascript" charset="utf-8" src="http://127.0.0.1/cms_edu/Static/ueditor/ueditor.config.js"></script>

	    <script type="text/javascript" charset="utf-8" src="http://127.0.0.1/cms_edu/Static/ueditor/ueditor.all.min.js"> </script>

	    <script type="text/javascript" charset="utf-8" src="http://127.0.0.1/cms_edu/Static/ueditor/lang/zh-cn/zh-cn.js"></script>
	    <!--上传插件uploadify的文件-->
		<script type="text/javascript" src="http://127.0.0.1/cms_edu/Static/uploadify/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="http://127.0.0.1/cms_edu/Static/uploadify/jquery.uploadify.min.js"></script>
		<link href="http://127.0.0.1/cms_edu/Static/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
		<script type="text/javascript">
			//让上传按钮显示
			function uploadifyShow(){
        			 $('#file').uploadify({
                    'formData'     : {//POST数据
                        '<?php echo session_name();?>' : '<?php echo session_id();?>',
                    },
                    'fileTypeDesc' : '上传文件',//上传描述
                    'fileTypeExts' : '*.jpg;*.png',
                    'swf'      : 'http://127.0.0.1/cms_edu/Static/uploadify/uploadify.swf',
                    'uploader' : '<?php echo U("upload");?>',
                    'buttonText':'选择文件',
                    'fileSizeLimit' : '2000KB',
                    'uploadLimit' : 1,//上传文件数
                    'width':65,
                    'height':25,
                    'multi': false,//是否多文件上传
                    'successTimeout':10,//等待服务器响应时间
                    'removeTimeout' : 0.2,//成功显示时间
                    'onUploadSuccess' : function(file, data, response) {
                    	//把变量转为json
                        data=$.parseJSON(data);
                        var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+data.url+"' style='width:200px;' class='img-thumbnail'/><a href='javascript:;' class='del-img'>X</a><input type='hidden' name='thumb' value='"+data.path+"' /></li>";
                        $("#uploadList ul").prepend(li);
                        //让删除按钮消失
                        $('.uplodify-box').html('');
                    }
                });
	        }
            $(function(){
            		//刷新页面让上传插件显示
            		uploadifyShow();
            		//点击x，隐藏图片，并且上传按钮显示
	  			$('.del-img').live('click',function(){
	  				//获得当前图片的所在的li，让其消失
	  				$(this).parent('li').hide();
	  				//上传按钮显示
	  				$('.uplodify-box').html('<input id="file" type="file" multiple="false"><span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>');
	  				uploadifyShow();
	  				
	  			})
            });
        </script>
	</head>
	<body>
		<form action="" method="post">
		
		<div class="alert alert-success">编辑文章</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章标题</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入分类名称" value="<?php echo $oldData['title'];?>"  name="title">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">作者</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder="请输入分类名称" value="<?php echo $oldData['author'];?>"  name="author">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">所属分类</label>
			<select name="category_cid" class="form-control">
				<option value="">请选择</option>
				<?php foreach ($cateData as $k=>$v){?>
					<option value="<?php echo $v['cid'];?>"     <?php if($oldData['category_cid']==$v['cid']){ ?>selected<?php } ?> ><?php echo $v['_name'];?></option>
				<?php }?>
			</select>
		</div>
        <div class="form-group">
			<label for="exampleInputEmail1">缩略图</label>
			  <div lab="uploadFile">
	           <div class="uplodify-box">
			  		<!--如果没有上传图片，显示上传按钮-->
				  	    <?php if(!$oldData['thumb']){ ?>
				  		<input id="file" type="file" multiple="false">
		            		<span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
				  	<?php } ?>
			  	</div>
			  	<div id="uploadList">
	                <ul>
	                		<!--如果有图片上传，则显示图片-->
	                		    <?php if($oldData['thumb']){ ?>
	                			<li>
		                			<img src="http://127.0.0.1/cms_edu/<?php echo $oldData['thumb'];?>" style="width: 100px;"/>
		                			<a href="javascript:;" class="del-img" path="<?php echo $oldData['thumb'];?>">X</a>
	                			</li>
	                		<?php } ?>
	                		
	                </ul>
	            </div>
	        </div>
		</div>
			
		<div id="">
			<label for="">文章属性</label>
			<br />
			<label class="checkbox checkbox-inline" for="checkbox1">
				<input id="checkbox1" class="custom-checkbox" type="checkbox" data-toggle="checkbox" value="热门"     <?php if(in_array('热门',$oldData['attr']) ){ ?>checked<?php } ?> name="attr[]">
				<span class="icons">
				<span class="icon-unchecked"></span>
				<span class="icon-checked"></span>
				</span>
				热门
			</label>
			<label class="checkbox checkbox-inline" for="checkbox2">
				<input id="checkbox2" class="custom-checkbox" type="checkbox" data-toggle="checkbox" value="置顶"     <?php if(in_array('置顶',$oldData['attr']) ){ ?>checked<?php } ?> name="attr[]" >
				<span class="icons">
				<span class="icon-unchecked"></span>
				<span class="icon-checked"></span>
				</span>
				置顶
			</label>
			<label class="checkbox checkbox-inline" for="checkbox3">
				<input id="checkbox3" class="custom-checkbox" type="checkbox" data-toggle="checkbox" value="推荐"     <?php if(in_array('推荐',$oldData['attr']) ){ ?>checked<?php } ?> name="attr[]" >
				<span class="icons">
				<span class="icon-unchecked"></span>
				<span class="icon-checked"></span>
				</span>
				推荐
			</label>
			<label class="checkbox checkbox-inline" for="checkbox4">
				<input id="checkbox4" class="custom-checkbox" type="checkbox" data-toggle="checkbox" value="图文"     <?php if(in_array('图文',$oldData['attr']) ){ ?>checked<?php } ?> name="attr[]">
				<span class="icons">
				<span class="icon-unchecked"></span>
				<span class="icon-checked"></span>
				</span>
				图文
			</label>
		</div>
		<div id="">
			<label for="">文章标签</label>
			<br />
			<?php foreach ($tag as $k=>$v){?>
				<label class="checkbox checkbox-inline" for="checkbox_<?php echo $k;?>">
					<input id="checkbox_<?php echo $k;?>" class="custom-checkbox" type="checkbox" data-toggle="checkbox" value="<?php echo $v['tid'];?>" name="tid[]"     <?php if(in_array($v['tid'],$tids)){ ?>checked<?php } ?> >
					<span class="icons">
					<span class="icon-unchecked"></span>
					<span class="icon-checked"></span>
					</span>
					<?php echo $v['tagname'];?>
				</label>
			<?php }?>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章关键字</label>
			<textarea name="keywords" rows="5" cols=""  class="form-control" placeholder="请输入文章关键字"><?php echo $oldData['keywords'];?></textarea>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章描述</label>
			<textarea name="description" rows="5" cols=""  class="form-control" placeholder="请输入文章描述"><?php echo $oldData['description'];?></textarea>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章摘要</label>
			<textarea name="digest" rows="5" cols=""  class="form-control" placeholder="请输入文章摘要"><?php echo $oldData['digest'];?></textarea>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章正文</label>
			
		    <script id="editor" type="text/plain" style="width:1024px;height:500px;" name="content"><?php echo $oldData['content'];?></script>
	
		    <script>
	
		        var ue = UE.getEditor('editor');
	
		    </script>

	  
		</div>
		<input type="hidden" name="aid" value="<?php echo $hd['get']['aid'];?>"/>
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
		</form>
	</body>
</html>
